<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/7/3 0003
 * Time: 上午 9:43
 */

namespace App\Http\Classes;


use Illuminate\Support\Facades\DB;

class Teacher
{
    private $table = 'teachers';
    private $teacherId = null;
    private $db;

    public function __construct($teacherId = null)
    {
        $this->db = DB::table($this->table);
        if ($teacherId !== null)
        {

        }
    }

    public function getTeacherIdByUserId($userId)
    {
        $teacherId = $this->db->where('userId','=',$userId)->select('teacherId')->get();
        //dd($teacherId);
        return $teacherId[0]->teacherId;
    }
}